package com.saihai.jiankang.ufLxgl.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.saihai.common.annotation.Log;
import com.saihai.common.core.controller.BaseController;
import com.saihai.common.core.domain.AjaxResult;
import com.saihai.common.enums.BusinessType;
import com.saihai.jiankang.ufLxgl.domain.UfLxgl;
import com.saihai.jiankang.ufLxgl.service.IUfLxglService;
import com.saihai.common.utils.poi.ExcelUtil;
import com.saihai.common.core.page.TableDataInfo;

/**
 * 新闻咨询类型Controller
 * 
 * @author ruoyi
 * @date 2024-08-10
 */
@RestController
@RequestMapping("/jiankang/ufLxgl")
public class UfLxglController extends BaseController
{
    @Autowired
    private IUfLxglService ufLxglService;

    /**
     * 查询新闻咨询类型列表
     */
    @GetMapping("/list")
    public TableDataInfo list(UfLxgl ufLxgl)
    {
        ufLxgl.setLxzt(0L);
        List<UfLxgl> list = ufLxglService.selectUfLxglList(ufLxgl);
        return getDataTable(list);
    }

    /**
     * 导出新闻咨询类型列表
     */
    @Log(title = "新闻咨询类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UfLxgl ufLxgl)
    {
        List<UfLxgl> list = ufLxglService.selectUfLxglList(ufLxgl);
        ExcelUtil<UfLxgl> util = new ExcelUtil<UfLxgl>(UfLxgl.class);
        util.exportExcel(response, list, "新闻咨询类型数据");
    }

    /**
     * 获取新闻咨询类型详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ufLxglService.selectUfLxglById(id));
    }

//    /**
//     * 新增新闻咨询类型
//     */
//    @Log(title = "新闻咨询类型", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody UfLxgl ufLxgl)
//    {
//        return toAjax(ufLxglService.insertUfLxgl(ufLxgl));
//    }
//
//    /**
//     * 修改新闻咨询类型
//     */
//    @Log(title = "新闻咨询类型", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody UfLxgl ufLxgl)
//    {
//        return toAjax(ufLxglService.updateUfLxgl(ufLxgl));
//    }
//
//    /**
//     * 删除新闻咨询类型
//     */
//    @Log(title = "新闻咨询类型", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(ufLxglService.deleteUfLxglByIds(ids));
//    }
}
